package com.ygxsk.carhome.ui.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.ui.livefee.FeeLivingExpensesOtherBean;
import com.ygxsk.carhome.utils.CommUtils;

import java.util.List;

//import com.ygxsk.carhome.response.FeeLivingExpensesBean;
/*
 * @Author:itchenqi175@163.com
 * @Time:2023-12-19  17:29
 * @Description:支付逻辑之中的其他逻辑
 */
public class FeeOtherFragmentAdapter extends BaseQuickAdapter<FeeLivingExpensesOtherBean, BaseViewHolder> {


    public FeeOtherFragmentAdapter(int layoutResId, @Nullable List<FeeLivingExpensesOtherBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, FeeLivingExpensesOtherBean feeLivingExpensesOtherBean) {

        if (feeLivingExpensesOtherBean != null) {

            //名称
            String name = feeLivingExpensesOtherBean.getName();
            //图片的逻辑填充
            int imageIds = feeLivingExpensesOtherBean.getImageIds();

            ImageView imageView = (ImageView) baseViewHolder.getView(R.id.imagegridinfeeother);
            TextView textViewLiveCode = (TextView) baseViewHolder.getView(R.id.textviewfeeothername);

            //赋值文本
            CommUtils.setText(textViewLiveCode, name);

            //图片是固定值
            Glide.with(getContext())
                    .load(imageIds)
                    .centerInside()//
                    .error(ContextCompat.getDrawable(getContext(), R.drawable.icon_errorfang))
                    .placeholder(ContextCompat.getDrawable(getContext(), R.drawable.icon_errorfang))
                    .fallback(ContextCompat.getDrawable(getContext(), R.drawable.icon_errorfang))
                    .into(imageView);

        }
    }
}
